package com.gitee.loyo.interfaces

import junit.framework.TestCase
import com.gitee.loyo.TUser
import com.gitee.loyo.interfaces.impl.UpdateByID
import org.junit.Test

class UpdateByIDTest : TestCase(){

    @Test
    fun test(){
        val tUser = TUser(1L, "baby", 2, null)
        val updateSQL = UpdateByID(tUser, TUser::userId.name)
        assertEquals("update t_user set user_name = ?, sex = ? where user_id = ?", updateSQL.getSQL())
        assertEquals(3, updateSQL.getParameters().size)
        assertEquals(tUser.userName, updateSQL.getParameters()[0])
        assertEquals(tUser.sex, updateSQL.getParameters()[1])
        assertEquals(tUser.userId, updateSQL.getParameters()[2])
    }
}